#! /bin/env python
#-*- coding: utf-8 -*-
import codecs

hiragana = u"ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん"
katakana = u"ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ・ーヽヾ"
ascii = u'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚ０１２３４５６７８９'
sym = u"ヽヾゝゞ〃仝々〆〇×＠○◎△※〒→←↑↓．−"


def notkanji(c):
    return not((c in hiragana) or (c in katakana) or (c in ascii) or (c in sym))
    
fin = codecs.open('edict.utf','r','utf-8')
fout = codecs.open('medict.utf','w','utf-8')

s = fin.readline()
while (s!=u""):
    m = s.split('[')
    if len(m)>1:
        k = list(m[0].strip())
        k=filter(notkanji, k)
        if len(k)>0:
            fout.write(s)
    s = fin.readline()

